import request from '@/utils/request'

// 查询商品分类列表
export function listCate(query) {
  return request({
    url: '/api/cate/list',
    method: 'get',
    params: query
  })
}

// 查询商品分类字典
export function dictList() {
  return request({
    url: '/api/cate/dictList',
    method: 'get'
  })
}

// 查询商品分类详细
export function getCate(id) {
  return request({
    url: '/api/cate/' + id,
    method: 'get'
  })
}

// 新增商品分类
export function addCate(data) {
  return request({
    url: '/api/cate',
    method: 'post',
    data: data
  })
}

// 修改商品分类
export function updateCate(data) {
  return request({
    url: '/api/cate',
    method: 'put',
    data: data
  })
}

// 删除商品分类
export function delCate(id) {
  return request({
    url: '/api/cate/' + id,
    method: 'delete'
  })
}



export function getOrderList(data) {
  return request({
    url: `/api/order/saleSearch?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: "post",
    data:data
  });
}


export function getSaleList(data) {
  return request({
    url: `/api/order/inSale?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: "post",
    data:data
  });
}


export function cancel(data) {
  return request({
    url: `/api/order/cancel?orderId=${data.id}`,
    method: "get",
  });
}

export function saleCount(data) {
  return request({
    url: `/api/order/saleCount`,
    method: "get",
  });
}

//获取物流状态
export function getProcess(id) {
  return request({
    url: `/api/order/getProcess?orderId=${id}`,
    method: "get",
  });
}


export function printAgain(code) {
  return request({
    url: `/profile/upload/pdf/sf/${code}.pdf`,
    method: "get",
  });
}

// /api/agent/agent/{ids}
// /api/agent/info/{ids}

export function delAgent(ids) {
  return request({
    url: `/api/agent/agent/${ids}`,
    method: "delete",
  });
}


export function delinfo(ids) {
  return request({
    url: '/api/agent/info/'+ ids,
    method: "delete",
  });
}

export function delGoods(id) {
  return request({
    url: '/api/goods/' + id,
    method: 'delete'
  })
}


export function achlist(query) {
  return request({
    url: '/api/performance/list',
    method: 'get',
    params: query
  })
}

export function getAch(id) {
  return request({
    url: '/api/performance/list/user?userId=' + id,
    method: 'get'
  })
}


export function performance(data) {
  return request({
    url: '/api/performance',
    method: 'post',
    data: data
  })
}

// /api/order/saleProcess
export function saleProcess(id) {
  return request({
    url: '/api/order/saleProcess?orderId='+ id,
      method: 'get'
  })
}

///api/order/saleRefuse
export function saleRefuse(id) {
  return request({
    url: '/api/order/saleRefuse?orderId='+ id,
      method: 'get'
  })
}